from pyglet.gl import *
import math
from awesum import Game, Drawable, Vector3

class Car(Drawable):
	"""Car, user controlled"""
	def __init__(self):
		super(Car, self).__init__(Drawable.Traits.GL | Drawable.Traits.MOVE)
	
	def load(self, game=None):
		super(Car, self).load(game)
		self.gl.id = self.game.loadModel("ship.stl", Game.ModelType.STL_BIN)
	
	def draw2(self):
		glPushMatrix()
		glColor3f(0, 1, 0)
		glTranslatef(self.origin.x, self.origin.y, self.origin.z)
		glRotatef(self.gl.rotation.x, 1, 0, 0)
		glRotatef(self.gl.rotation.z, 0, 0, 1)
		glRotatef(self.gl.rotation.y, 0, 1, 0)
		glScalef(self.scale.x, self.scale.y, self.scale.z)
		glCallList(self.listId)
		glPopMatrix()
	